package app.netant.book.kenshu;

import org.jsoup.select.Elements;

import app.netant.book.base.BaseDetail;
/**
 * 
 * @author JiaJ
 *
 */
public class KenshuDetail extends BaseDetail {

	public KenshuDetail(String netSite) {
		super(netSite);
		this.preHref = "https://www.kenshu.cc";
	}

	@Override
	public void analyseTitle() {
		Elements parts = this.select("#conn .auto.wrapper .fleft.column-l .layout .bookcover-hd .booktitle .name h1");
		if(parts.size()>0){
			String title = parts.get(0).text();
			System.out.println("【Title】:"+title);
			this.entity.setNovelName(title);
			this.entity.setNovelFullName(title+".txt");
		}
	}

	@Override
	public void analyseTags() {
		
	}

	@Override
	public void analyseMemo() {
		Elements parts = this.select("#conn .auto.wrapper .fleft.column-l .layout .bookcover-bd .fright.bookcover-r .book-intro");
		if(parts.size()>0){
			String memo = this.getString(parts.get(0).firstElementSibling().text());
			System.out.println("【Memo】:"+memo);
			this.entity.setNovelMemo(memo);
		}
	}

	@Override
	public void analyseHref() {
		Elements parts = this.select("#conn .auto.wrapper .fleft.column-l .layout .bookcover-bd .fright.bookcover-r .bookbtn-box .bookbtn-txt a.readingbtn2");
		if(parts.size()>0){
			String href = parts.get(0).attr("href");
			System.out.println("【Href】:"+href);
			this.entity.setDownPath(href);
		}
	}
	
	@Override
	public void analyseType() {
		Elements parts = this.select("#conn .auto.wrapper .fleft.column-l .layout .bookcover-hd .booktitle p a");
		if(parts.size()>0){
			String type = parts.get(0).text();
			System.out.println("【Type】:"+type);
			this.entity.setNovelType(type);
		}
	}
	
	public static void main(String[] args) {
		KenshuDetail detail = new KenshuDetail("https://www.kenshu.cc/xiaoshuo/23375/");
		detail.test();
	}



}
